package enums;

public enum TaskResCodeEnum {

    CREATE_SUCCESS(10000,"任务创建成功"),
    CREATE_FAILED(10001,"任务创建失败"),
    UPDATE_SUCCESS(10002,"任务修改成功"),
    UPDATE_FAILED(10003,"任务修改失败"),
    REMOVE_SUCCESS(10004,"删除修改成功"),
    REMOVE_FAILED(10005,"删除修改失败"),
    LIST_SUCCESS(10006,"获取任务列表成功"),
    LIST_FAILED(10007,"获取任务列表失败"),
    NO_DATA(80001,"没有任务数据")
    ;


    private Integer code;
    private String msg;
    TaskResCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static String getMsgByCode(Integer code) {
        String msg = "";
        TaskResCodeEnum[] array = TaskResCodeEnum.values();
        for (TaskResCodeEnum obj : array) {
            if (code.equals(obj.code)) {
                msg = obj.msg;
                break;
            }
        }
        return msg;
    }
}
